home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1995 November
/
EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso
/
earcd
/
program
/
gcc
/
gcc270-d.lha
/
gnu
/
man
/
cat3
/
ctime.0
< prev
next >
Wrap
Text File
|
1992-08-10
|
7KB
|
199 lines
CTIME(3) UNIX Programmer's Manual CTIME(3)
NNAAMMEE
aassccttiimmee, ccttiimmee, ddiiffffttiimmee, ggmmttiimmee, llooccaallttiimmee, mmkkttiimmee - transform binary
date and time value to ASCII
SSYYNNOOPPSSIISS
##iinncclluuddee <<ssyyss//ttyyppeess..hh>>
_e_x_t_e_r_n _c_h_a_r _*_t_z_n_a_m_e_[_2_]_;
_c_h_a_r _*
ccttiimmee(_c_o_n_s_t _t_i_m_e___t _*_c_l_o_c_k)
_d_o_u_b_l_e
ddiiffffttiimmee(_t_i_m_e___t _t_i_m_e_1, _t_i_m_e___t _t_i_m_e_0)
##iinncclluuddee <<ttiimmee..hh>>
_c_h_a_r _*
aassccttiimmee(_c_o_n_s_t _s_t_r_u_c_t _t_m _*_t_m)
_s_t_r_u_c_t _t_m _*
llooccaallttiimmee(_c_o_n_s_t _t_i_m_e___t _*_c_l_o_c_k)
_s_t_r_u_c_t _t_m _*
ggmmttiimmee(_c_o_n_s_t _t_i_m_e___t _*_c_l_o_c_k)
_t_i_m_e___t
mmkkttiimmee(_s_t_r_u_c_t _t_m _*_t_m)
DDEESSCCRRIIPPTTIIOONN
The functions ccttiimmee(), ggmmttiimmee() and llooccaallttiimmee() all take as an argument a
time value representing the time in seconds since the Epoch (00:00:00
UTC, January 1, 1970; see time(3)).
The function llooccaallttiimmee() converts the time value pointed at by _c_l_o_c_k, and
returns a pointer to a ``_s_t_r_u_c_t _t_m'' (described below) which contains the
brokenout time information for the value after adjusting for the current
time zone (and any other factors such as Daylight Saving Time). Time
zone adjustments are performed as specified by the TZ environmental vari
able (see tzset(3)). The function llooccaallttiimmee() uses tzset to initialize
time conversion information if tzset has not already been called by the
process.
After filling in the tm structure, llooccaallttiimmee() sets the _t_m___i_s_d_s_t'th ele
ment of _t_z_n_a_m_e to a pointer to an ASCII string that's the time zone ab
breviation to be used with llooccaallttiimmee()'s return value.
The function ggmmttiimmee() similarly converts the time value, but without any
time zone adjustment, and returns a pointer to a tm structure (described
below).
The ccttiimmee() function adjusts the time value for the current time zone in
the same manner as llooccaallttiimmee(), and returns a pointer to a 26character
string of the form:
Thu Nov 24 18:22:48 1986\n\0
All the fields have constant width.
The aassccttiimmee() function converts the broken down time in the structure _t_m
pointed at by _*_t_m to the form shown in the example above.
The function mmkkttiimmee() converts the brokendown time, expressed as local
time, in the structure pointed to by tm into a time value with the same
encoding as that of the values returned by the time(3) function, that is,
seconds from the Epoch, UTC.
The original values of the _t_m___w_d_a_y and _t_m___y_d_a_y components of the struc
ture are ignored, and the original values of the other components are not
restricted to their normal ranges. (A positive or zero value for
_t_m___i_s_d_s_t causes mmkkttiimmee() to presume initially that summer time (for exam
ple, Daylight Saving Time) is or is not in effect for the specified time,
respectively. A negative value for _t_m___i_s_d_s_t causes the mmkkttiimmee() function
to attempt to divine whether summer time is in effect for the specified
time.)
On successful completion, the values of the _t_m___w_d_a_y and _t_m___y_d_a_y compo
nents of the structure are set appropriately, and the other components
are set to represent the specified calendar time, but with their values
forced to their normal ranges; the final value of _t_m___m_d_a_y is not set un
til _t_m___m_o_n and _t_m___y_e_a_r are determined. MMkkttiimmee() returns the specified
calendar time; if the calendar time cannot be represented, it returns -1;
The ddiiffffttiimmee() function returns the difference between two calendar
times, (_t_i_m_e_1 _t_i_m_e_0), expressed in seconds.
External declarations as well as the tm structure definition are in the
<_t_i_m_e_._h> include file. The tm structure includes at least the following
fields:
int tm_sec; /* seconds (0 60) */
int tm_min; /* minutes (0 59) */
int tm_hour; /* hours (0 23) */
int tm_mday; /* day of month (1 31) */
int tm_mon; /* month of year (0 11) */
int tm_year; /* year - 1900 */
int tm_wday; /* day of week (Sunday = 0) */
int tm_yday; /* day of year (0 365) */
int tm_isdst; /* is summer time in effect? */
char *tm_zone; /* abbreviation of timezone name */
long tm_gmtoff; /* offset from UTC in seconds */
The field _t_m___i_s_d_s_t is nonzero if summer time is in effect.
The field _t_m___g_m_t_o_f_f is the offset (in seconds) of the time represented
from UTC, with positive values indicating east of the Prime Meridian.
SSEEEE AALLSSOO
date(1), gettimeofday(2), getenv(3), time(3), tzset(3), tzfile(5)
HHIISSTTOORRYY
This manual page is derived from the time package contributed to Berkeley
by Arthur Olsen and which appeared in 4.3BSD.
BBUUGGSS
Except for ddiiffffttiimmee() and mmkkttiimmee(), these functions leaves their result
in an internal static object and return a pointer to that object. Subse
quent calls to these function will modify the same object.
The _t_m___z_o_n_e field of a returned tm structure points to a static array of
characters, which will also be overwritten by any subsequent calls (as
well as by subsequent calls to tzset(3) and tzsetwall(3)).
Use of the external variable _t_z_n_a_m_e is discouraged; the _t_m___z_o_n_e entry in
the tm structure is preferred.
Avoid using outofrange values with mmkkttiimmee() when setting up lunch with
promptness sticklers in Riyadh.
4.3 Berkeley Distribution April 19, 1991 3